﻿@{
    ViewBag.Title = "课程列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using Web.helper;
@{

}
@section list
{
    <div class="panel-body" style="padding-bottom:0px;">
        <div class="panel panel-default">
            <div class="panel-heading">查询条件
                <div style="float:right;cursor:pointer">
                    <i data-toggle="collapse" data-target="#searchContent" aria-expanded="false" aria-controls="searchContent" class="fa fa-binoculars"></i>
                </div>
            </div>
            <div id="searchContent" class="panel-body collapse in">
                <form id="formSearch" class="form-horizontal">
                    <div class="form-group" style="margin-top:15px">
                        <div class="col-sm-10">
                            <label class="control-label col-sm-1" for="txt_search_lessonname">课程名称</label>
                            <div class="col-sm-2">
                                <input type="text" class="form-control" id="lessonname" name="lessonname">
                            </div>
                            <label class="control-label col-sm-1" for="txt_search_seriesid">系列</label>
                            <div class="col-sm-2">
                                @Html.Raw(Html.select_lessonList("lessonList"))
                            </div>
                            <label class="control-label col-sm-1" for="txt_search_categoryid">类目</label>
                            <div class="col-sm-2">
                                @Html.Raw(Html.select_lessonType2("lessonType"))
                            </div>
                            <label class="control-label col-sm-1" for="txt_search_teacherid">老师</label>
                            <div class="col-sm-2">
                                @Html.Raw(Html.select_Teacher("teacher"))
                            </div>
                        </div>
                        <div class="col-sm-1">
                            <button type="button" id="btn_query" class="btn btn-primary">查询</button>
                        </div>
                        <div class="col-sm-1">
                            <button type="button" id="btn_clear" class="btn btn-default">重置</button>
                        </div>
                        <div class="col-sm-10" style="margin-top:20px">
                            <label class="control-label col-sm-1" for="txt_search_teacherid">开课时间</label>
                            <div class="col-sm-2">
                                <input placeholder="开课时间开始" class="laydate-icon form-control layer-date" id="startDate" name="startDate" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})">
                            </div>
                            <label class="control-label col-sm-1" for="txt_search_teacherid">开课时间</label>
                            <div class="col-sm-2">
                                <input placeholder="开课时间结束" class="laydate-icon form-control layer-date" id="endDate" name="startDate" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <script type="text/javascript" src="~/js/contabs.min.js"></script>
        <div id="toolbar" class="btn-group">
            <button id="btn_add" type="button" class="btn btn-blue"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>添加</button>
            <button id="btn_edit" type="button" class="btn btn-warning"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改</button>
            <button id="btn_delete" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除</button></div>
        <table id="tb_departments"></table>
    </div>

}
@section add
{
    @RenderPage("~/Areas/Admin/Views/Lesson/_edit.cshtml")
}
@section exam
{

}
@section js
{
    <script src="~/js/lsj/Lesson.js"></script>

<script>
    //提交的onclick,此时还可以修改表单里面的值,且后台可以获取
    function onck() {
        $('.selectpicker').selectpicker('refresh');//不加这个,默认显示无法获取

        //if ($("#txt_lessonList").val() == 0)
        //{
        //    point("", "请选择系列!");
        //    return false;
        //}
        if ($("#txt_lessonType").val() ==0 ) {
            point("", "请选择类目!");
            return false;
        }
        if ($("#txt_teacher").val() == 0) {
            point("", "请选择老师!");
            return false;
        }
        if ($("#txt_powerlist").val() == null) {
            point("", "观看权限必须选一个用户组");
            return false;
        }
    }

    //登录前js验证
    function ValidateLog() {
        $.loading(true);
    }


    //登录回调函数
    function tips(data) {
        $.loading(false);

        if (data.status == 0) {
            //添加成功

            //显示模态框
            $.dialog(data.msg, 0);
            //先关闭主窗体
            $('#myModal').modal('hide')
            //刷新数据
            $('#tb_departments').bootstrapTable('refresh', { url: '/Lesson/GetLessonList' });

        } else if (data.pitchId != "") {
            point(data.pitchId, data.msg);
        } else {
            //添加失败
            $.dialog(data.msg, -1);
        }
    }

    //输出提示信息
    function point(id, content) {
        var follow = document.getElementById(id);
        var d = dialog({
            align: 'bottom',
            content: '<span class="label label-warning">!</span> ' + content
        });
        d.show(follow);
        setTimeout(function () {
            d.close().remove();
        }, 2000);
    }

    //清空
    $("#btn_clear").click(function () {
        $("#lessonname").val('');
        $('.selectpicker').selectpicker('val', 0);
        $("#startDate").val('');
        $("#endDate").val('');
    });


</script>
}

